package com.zensun.web.controller.common;

import com.zensun.common.core.domain.R;
import com.zensun.common.utils.file.OssFileUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 通用请求处理
 *
 * @author gmk
 */
@Api(value = "CommonController", tags = "通用请求处理")
@RestController
public class CommonController {

    /**
     * 通用上传请求
     */
    @ApiOperation("通用上传请求")
    @PostMapping("/common/ossupload")
    public R uploadOssFile(MultipartFile file) {
        String url = "";
        try {
            url = OssFileUtils.upload(file);
        } catch (Exception e) {
            return R.error();
        }
        return R.success("操作成功",url);
    }
}
